package com.wang.spring.lifecycle.c_initializingbean;

import org.springframework.beans.factory.DisposableBean;
import org.springframework.beans.factory.InitializingBean;
import org.springframework.stereotype.Component;


@Component
public class Pen implements InitializingBean, DisposableBean {

    private Integer ink;


    @Override
    public void afterPropertiesSet() throws Exception {
        System.out.println("Pen 钢笔中已经加满墨水  InitializingBean.afterPropertiesSet");
        this.ink = 100;

    }

    @Override
    public void destroy() throws Exception {
        System.out.println("Pen 钢笔中墨水都放干净了  DisposableBean.destroy");
        this.ink = 0;
    }

    @Override
    public String toString() {
        return "Pen{" +
                "ink=" + ink +
                '}';
    }
}
